/*
 * Title:        CloudScheduler Toolkit
 * Description:  a Toolkit for Modeling and Simulation of Job Scheduling and Resource Provisioning in Cloud System
 * Licence:      GPL - http://www.gnu.org/copyleft/gpl.html
 * Author:       Fuhui Wu
 *
 * Copyright (c) 2013-2014, The National University of Defense Technology, China
 */

package org.nudt.jCloud.resourceScaler;

import org.nudt.jCloud.infrastructure.SlotType;
import org.nudt.jCloud.simulation.RequestData;
import org.nudt.jCloud.simulation.ScaleData;

public class ConstantScaler extends ResourceScaler{
	private SlotType slotType;
	private int slotNum;
	private boolean scaled;
	
	public ConstantScaler(SlotType slotType, int slotNum){
		super();
		setSlotType(slotType);
		setSlotNum(slotNum);
		scaled = false;
	}	

	@Override
	public void specialReset() {
		scaled = false;		
	}

	@Override
	public void scaleResource(RequestData requestData, ScaleData scaleData) {
		if(scaled == false){
			scaleData.getToLeaseSlot().put(slotType, slotNum);			
			setScaled(true);
		}
		
	}
	
	public int getSlotNum(){
		return slotNum;
	}
	
	public void setSlotNum(int slotNum){
		this.slotNum = slotNum;
	}
	
	public boolean isScaled(){
		return scaled;
	}
	
	public void setScaled(boolean scaled){
		this.scaled = scaled;
	}

	public SlotType getSlotType() {
		return slotType;
	}

	public void setSlotType(SlotType slotType) {
		this.slotType = slotType;
	}

}
